package com.wangan.wanganpush.stomp.RelinkMap;

import java.util.Vector;

/**
 * stomp连接的重连列表
 * xufm
 */

public class ThreadMap {
	    //重连列表
		public static Vector<String> relinkedThread;
		static{
			relinkedThread = new Vector<String>();
		}
		
		//增加重连线程
		public  synchronized static boolean addThread(String threadName){
			if(threadName == null || " ".equalsIgnoreCase(threadName))
			return false;
			relinkedThread.add(threadName);
			return true;
		}
		
		//
		public synchronized static boolean isExist(String threadName){
			if(threadName == null || " ".equalsIgnoreCase(threadName))return false;
			
			if(relinkedThread.contains(threadName)){
				return true;
			}else{
				return false;
			}
		}
		
		//移除线程
		public synchronized static boolean removeThreadName(String threadName){
			if(threadName == null || " ".equalsIgnoreCase(threadName))return false;
			
			if(relinkedThread.remove(threadName)){
				return true;
			}else{
				return false;
			}
		}
		
}
